package com.xiu.jvm.oom;

/**
 * VM args: -Xss2M
 * 
 * @author wangxinxin
 *
 */
public class JavaVMStackOOM {

	private void dontstop() {
		while (true) {

		}
	}

	public void stackLeakByThread() {
		while (true) {
			Thread thread = new Thread(new Runnable() {

				public void run() {
					dontstop();
				}
			});
			thread.start();
		}
	}

	public static void main(String[] args) throws Throwable {
		JavaVMStackOOM oom = new JavaVMStackOOM();
		oom.stackLeakByThread();
	}

}
